<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Ejemplo 2 - JavaWebAjax</title>

<script type='text/javascript'>
		var req=null;
		var console=null;
		var READY_STATE_UNINITIALIZED=0;
		var READY_STATE_LOADING=1;
		var READY_STATE_LOADED=2;
		var READY_STATE_INTERACTIVE=3;
		var READY_STATE_COMPLETE=4;

		function HolaMundoAjax(){
			if (window.XMLHttpRequest){
			req = new XMLHttpRequest();
			}
			else if (window.ActiveXObject){
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (req){
				req.onreadystatechange = funcionAsincronaRecepcion;
				req.open("GET", "HolaMundo", true);
				req.send(null);
			}
		}

		function funcionAsincronaRecepcion(){
			var ready=req.readyState;
			var data=null;
			if (ready==READY_STATE_COMPLETE)
			{
				alert(req.responseText);
			}
		}
	
		window.onload=function(){
			HolaMundoAjax();
		}
</script>
</head>
<body>
</body>
</html>